package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppCostBudgetReportMapper;
import com.ep.modules.app.entity.AppCostBudgetReport;
import com.ep.modules.app.entity.AppCostBudgetReportExample;
import com.ep.modules.app.service.AppCostBudgetReportService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppCostBudgetReportServiceImpl implements AppCostBudgetReportService {
    @Autowired
    private AppCostBudgetReportMapper appCostBudgetReportMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppCostBudgetReportExample example = new AppCostBudgetReportExample();
        AppCostBudgetReportExample.Criteria criteria = example.createCriteria();
        List<AppCostBudgetReport> list = appCostBudgetReportMapper.selectByExample(example);
        Page<AppCostBudgetReport> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppCostBudgetReport getById(Long id) {
        return appCostBudgetReportMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppCostBudgetReport entity) {
        appCostBudgetReportMapper.insert(entity);
    }

    public void update(AppCostBudgetReport entity) {
        appCostBudgetReportMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appCostBudgetReportMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}